/********************************************************************
	Rhapsody	: 7.5 
	Login		: KBE
	Component	: DefaultComponent 
	Configuration 	: ClientCodeConfig
	Model Element	: LogAcceptor
//!	Generated Date	: Sun, 23, Sep 2012  
	File Path	: DefaultComponent\ClientCodeConfig\LogAcceptor.cpp
*********************************************************************/

//## auto_generated
#include "LogAcceptor.h"
//## auto_generated
#include "Reactor.h"
//## dependency LogEvent
#include "LogEvent.h"
//## package Default

//## class LogAcceptor
LogAcceptor::LogAcceptor(Reactor* reactor, HANDLE h) {
    //#[ operation LogAcceptor(Reactor*,HANDLE)
    handle = h;
    type = ACCEPT_EVENT;
    itsReactor = reactor;
    //#]
}

LogAcceptor::LogAcceptor(Reactor * reactor, SOCK_Acceptor * acceptor) : acceptor_(acceptor)  {
    //#[ operation LogAcceptor(Reactor *,SOCK_Acceptor *)
    //#[ operation LogAcceptor(Reactor*,SOCK_Acceptor)
    handle = (HANDLE)acceptor->get_handle();
    itsReactor = reactor;
    itsReactor->registerHandler(*this, ACCEPT_EVENT);
    //#]
}

LogAcceptor::LogAcceptor() {
}

LogAcceptor::~LogAcceptor() {
}

void LogAcceptor::handleEvent(HANDLE h, Event_Type& et) {
    //#[ operation handleEvent(HANDLE,Event_Type)
    if (et == type)
    {   
    	SOCK_Stream *client_connection = new SOCK_Stream();
    	acceptor_->accepting(*client_connection); 
    	LogEvent *log = new LogEvent(itsReactor, client_connection);
    	//itsReactor->removeHandler(*this, type);
    }
    //#]
}

SOCK_Acceptor * LogAcceptor::getAcceptor_() const {
    return acceptor_;
}

void LogAcceptor::setAcceptor_(SOCK_Acceptor * p_acceptor_) {
    acceptor_ = p_acceptor_;
}

/*********************************************************************
	File Path	: DefaultComponent\ClientCodeConfig\LogAcceptor.cpp
*********************************************************************/
